# 构建阶段：使用华为云Node.js 20 Alpine镜像
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/node:20-alpine3.20-linuxarm64 as build
WORKDIR /app
COPY package*.json ./
RUN npm install --production 
COPY . .
RUN npm run build 

# 运行阶段：使用华为云Nginx 1.24.0镜像
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/nginx:1.24.0
COPY --from=build /app/dist /usr/share/nginx/html 
EXPOSE 80 
CMD ["nginx", "-g", "daemon off;"] 